/*
 * SystemTools.cpp
 *
 *  Created on: 2 mars 2013
 *      Author: raph
 */

#if defined _WIN32 || defined _WIN64
#include <windows.h>
#else
#include <unistd.h>
#endif
#include "SystemTools.h"

namespace raph
{
unsigned int SystemTools::getNbCores()
    {
    unsigned int N = 0;
#if defined _WIN32 || defined _WIN64
    SYSTEM_INFO sysinfo;
    GetSystemInfo(&sysinfo);
    N = sysinfo.dwNumberOfProcessors;
#else
    N = static_cast<unsigned int>(sysconf(_SC_NPROCESSORS_ONLN));
#endif
    return N;
    }
}
